{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "4bafa656",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello world  0\n",
      "hello world  1\n",
      "hello world  2\n",
      "hello world  3\n",
      "hello world  4\n",
      "hello world  5\n",
      "hello world  6\n",
      "hello world  7\n",
      "hello world  8\n",
      "hello world  9\n",
      "hello world  10\n",
      "hello world  11\n",
      "hello world  12\n",
      "hello world  13\n",
      "hello world  14\n",
      "hello world  15\n",
      "hello world  16\n",
      "hello world  17\n",
      "hello world  18\n",
      "hello world  19\n",
      "hello world  20\n",
      "hello world  21\n",
      "hello world  22\n",
      "hello world  23\n",
      "hello world  24\n",
      "hello world  25\n",
      "hello world  26\n",
      "hello world  27\n",
      "hello world  28\n",
      "hello world  29\n",
      "hello world  30\n",
      "hello world  31\n",
      "hello world  32\n",
      "hello world  33\n",
      "hello world  34\n",
      "hello world  35\n",
      "hello world  36\n",
      "hello world  37\n",
      "hello world  38\n",
      "hello world  39\n",
      "hello world  40\n",
      "hello world  41\n",
      "hello world  42\n",
      "hello world  43\n",
      "hello world  44\n",
      "hello world  45\n",
      "hello world  46\n",
      "hello world  47\n",
      "hello world  48\n",
      "hello world  49\n"
     ]
    }
   ],
   "source": [
    "for i in range(50):\n",
    "    print(\"hello world \", i)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0a43cccd",
   "metadata": {},
   "source": [
    "# 表达式"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "3f58acb9",
   "metadata": {},
   "outputs": [],
   "source": [
    "a = 10\n",
    "b = 10.5\n",
    "c = \"hello\"\n",
    "d = 'hello'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "e0c8113a",
   "metadata": {},
   "outputs": [],
   "source": [
    "e = \"\"\"\n",
    "adfhe  afhe \n",
    "afdadse \n",
    "kkkdfdsf\n",
    "\n",
    "dsfsdfs\n",
    "dfsfs\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "fcfdb687",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "int"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "6771577f",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "140731943251152"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "id(a)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "5177faf3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "float"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "c77a2b8e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "str"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(e)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "0d537a16",
   "metadata": {},
   "outputs": [],
   "source": [
    "int add(int a, int b)\n",
    "{\n",
    "    return a + b;\n",
    "}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "79628959",
   "metadata": {},
   "outputs": [],
   "source": [
    "def add(a, b):\n",
    "    \n",
    "    return a + b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "56e5e825",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "add(1,2)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "15301ed1",
   "metadata": {},
   "source": [
    "# 类"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "60c42457",
   "metadata": {},
   "outputs": [],
   "source": [
    "class Animal:\n",
    "    def __init__(self):\n",
    "        age = 1\n",
    "        weight = 10\n",
    "        color = 'yellow'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "b7d79b92",
   "metadata": {},
   "outputs": [],
   "source": [
    "class Dog(Animal):\n",
    "    def __init__(self, dog_name):\n",
    "        super().__init__()\n",
    "        name = dog_name\n",
    "    \n",
    "    def run(self):\n",
    "        print(\"Running\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "e0ac2e5e",
   "metadata": {},
   "outputs": [],
   "source": [
    "class Cat( Animal ):\n",
    "    def __init__(self):\n",
    "        super().__init__()\n",
    "    \n",
    "    def cry(self):\n",
    "        print(\"Cat cry\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "2ccb58ca",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(type, type)"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(Dog), type(int)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "edaea6bc",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<__main__.Dog at 0x260441be280>"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = Dog('tome')\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "858754ae",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<__main__.Cat at 0x26043fbce50>"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b = Cat()\n",
    "b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "7e61581d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Cat cry\n"
     ]
    }
   ],
   "source": [
    "b.cry()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bc30079b",
   "metadata": {},
   "source": [
    "a.run()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "4869a717",
   "metadata": {},
   "outputs": [],
   "source": [
    "import random"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "id": "43a35e28",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "7\n",
      "8\n",
      "11\n",
      "10\n",
      "9\n",
      "11\n",
      "12\n",
      "6\n",
      "11\n",
      "8\n",
      "7\n",
      "9\n",
      "9\n",
      "11\n",
      "9\n",
      "10\n",
      "9\n",
      "5\n",
      "11\n",
      "7\n",
      "11\n",
      "7\n",
      "7\n",
      "6\n",
      "10\n",
      "9\n",
      "12\n",
      "13\n",
      "10\n",
      "9\n",
      "10\n",
      "9\n",
      "8\n",
      "11\n",
      "8\n",
      "8\n",
      "11\n",
      "11\n",
      "7\n",
      "9\n",
      "10\n",
      "9\n",
      "9\n",
      "14\n",
      "9\n",
      "10\n",
      "8\n",
      "11\n",
      "10\n",
      "8\n"
     ]
    }
   ],
   "source": [
    "for i in range(50):\n",
    "    print( int( random.gauss(10, 2) ) )"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.16"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
